package com.frogs.ucenter.v1.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.frogs.framework.base.web.BaseController3;
import com.frogs.system.web.api.response.FailResponse;
import com.frogs.system.web.api.response.Response;
import com.frogs.system.web.exception.AppBaseException;
import com.frogs.ucenter.v1.request.UserFamilyMemberTagShowRequest;
import com.frogs.ucenter.v1.service.UserFamilyMemberService;
import com.frogs.ucenter.v1.util.ApiConstants;

@Controller(ApiConstants.VERSION + "tagFamilyMemberRelationController")
@RequestMapping("/" + ApiConstants.VERSION )
public class TagFamilyMemberRelationController extends BaseController3 {
	
    private static final String ROOT = "/tag";
    
    private static final String TAG_FAMILY_MEMBER_LIST = ROOT + "/familyMember/list";
    @Resource(name=ApiConstants.VERSION+"userFamilyMemberService")
	private UserFamilyMemberService userFamilyMemberService;

	@RequestMapping({TAG_FAMILY_MEMBER_LIST})
	public Response tagFamilyMemberList(HttpServletRequest request, ModelMap model) {
		Response response = null ;
		try{
			UserFamilyMemberTagShowRequest infoRequest = new UserFamilyMemberTagShowRequest();
			infoRequest.parse(request);
			response = userFamilyMemberService.getTags(infoRequest);
		}catch (Exception e) {
			response = new FailResponse();
			if (e instanceof AppBaseException) {
				response.setTip(e.getMessage());
			} else {
				response.setTip("errro message" + e.getMessage());
			}
		}
		return response;
	}
    
}